<?php
	if(!defined('BASEPATH'))
		exit('No direct script access allowed');

	class m_Signup extends CI_Model
	{
		function __construct()
    	{
    	    // Call the Model constructor
    	    parent::__construct();
    	}

    	function add_user($userEmail, $userPassword)
    	{
			$this->load->database();
    		// Check whether the userEmail already exists in the database
			$query = $this->db->get_where('tblUser', array('userEmail' => $userEmail));
			$query_result_size = sizeof($query->result());

			if($query_result_size)
			{
				return -1;
			}
			else
			{
				$data = array(
    				'userEmail' => "$userEmail",
    				'userPassword' => crypt($userPassword)
    			);
				$this->db->insert('tblUser', $data);
				return 0;
			}
    	}
	}
?>
